﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript" src="../js/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="../js/Interface.js"></script>
    <script type="text/javascript" src="../js/Helpers.js"></script>
</head>
<body>
    <div id="content">
    </div>
    <script type="text/javascript">
        /* Class Person. */
        function Person(name) {
            this.name = name;
        }
        Person.prototype.getName = function () {
            return this.name;
        }
        /* Class Author. */
        function Author(name, books) {
            Person.call(this, name); // Call the superclass's constructor in the scope of this.
            this.books = books; // Add an attribute to Author.
        }
        Author.prototype = new Person(); // Set up the prototype chain.
        Author.prototype.constructor = Author; // Set the constructor attribute to Author.
        Author.prototype.getBooks = function () { // Add a method to Author.
            return this.books;
        };

        $(function () {
            var author = [];
            author[0] = new Author('Dustin Diaz', ['JavaScript Design Patterns']);
            author[1] = new Author('Ross Harmes', ['JavaScript Design Patterns']);

            $("#content").html(String.format("{0} - {1}", author[1].getName(), author[1].getBooks()));
        });
    </script>
</body>
</html>
